package com.jincheng.web;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

/**
 * @author Jane
 * @date 2024-12-23 12:01
 */

public class UserController extends AbstractController {
    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
        ModelAndView mv = null;

        System.out.println("hello --spring mvc");

        System.out.println("username: "+ request.getParameter("username"));
        System.out.println("passsword: "+ request.getParameter("passsword"));

        if ("admin".equals(request.getParameter("username"))){
            if ("123456".equals(request.getParameter("passsword"))){
                mv = new ModelAndView("success.jsp");//request.getDis..("success.jsp")...forward()
            }else{
                mv = new ModelAndView("login.jsp");
            }
        }

        return mv;
    }
}
